package GUI;


/**
 * @author mishel hen
 *
 */

import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;

import javax.naming.spi.DirStateFactory.Result;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

import client.ClientConsole;

import Library.ReaderCard;
/**
 * This class is the display reader card of student
 */
public class GUI_DisplayReaderCard extends JPanel
{
	/**
	 * client Connected
	 */
	private ClientConsole cc;
	/**
	 * panel for edit reader card
	 */
	private GUI_EditReaderCard erc;
	/**
	 * class ReaderCard
	 */
	private  ReaderCard readercard;
	/**
	 * panel for display reader card
	 */ 
	private GUI_DisplayReaderCard drc = this;
	/**
	 * Displays the details of the reader card 
	 * @param clc
	 * @param readercard2
	 * @param mms
	 */
	public GUI_DisplayReaderCard(ClientConsole clc, ReaderCard readercard2, final GUI_MainMenuStudent mms)
	{
		super();	
		cc = clc;
		readercard = readercard2;
		this.setSize(600, 400);
		JButton btnEdit = new JButton("Edit personal details");

		btnEdit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
					    erc=new GUI_EditReaderCard(cc,readercard,drc);
					    cc.cgui.setContentPane(erc);
		}});
		
	
	setLayout(null);
	btnEdit.setBounds(60, 320, 200, 30);
	this.add(btnEdit);
	this.setVisible(true);	
		JLabel lblTitle = new JLabel("Reader card ");
		lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 24));

		lblTitle.setBounds(230, 20, 200, 40);
		add(lblTitle);
		
		JLabel lblUsername = new JLabel("User name: " + cc.userName );
		lblUsername.setBounds(60, 70, 200, 20);
		add(lblUsername);
		
		JLabel lblPhone = new JLabel("Phone: " + readercard.getPhone());
		lblPhone.setBounds(60, 110, 200, 20);
		add(lblPhone);
		
		JLabel lblEmail = new JLabel("Email: " + readercard.getEmail());
		lblEmail.setBounds(60, 150, 200, 20);
		add(lblEmail);
		
		JLabel lblFirstName = new JLabel("First Name: " + readercard.getFirstName());
		lblFirstName.setBounds(60, 190, 200, 20);
		add(lblFirstName);
		
		JLabel lblLastName = new JLabel("Last Name: " + readercard.getLastName());
		lblLastName.setBounds(60, 230, 200, 20);
		add(lblLastName);
		
		JLabel lblStatus = new JLabel("Status: " + readercard.getStatus());
		lblStatus.setBounds(60, 270, 200, 20);
		add(lblStatus);
		
		JButton btnBack = new JButton("Back");
		btnBack.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cc.cgui.setContentPane(mms);
			}
		})
		;
		btnBack.setBounds(270, 320, 90, 30);
		add(btnBack);
		
	}
	
}